<%-- 
    Document   : ModuleForm.jsp
    Created on : Jan 4, 2012, 4:56:14 PM
    Author     : User
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html"  prefix="html" %> 
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/struts-tags" prefix="s" %>

<s:if test="isUpdate == false">
    <s:set name="title" value="%{'Add'}"/>
</s:if>
<s:else>
    <s:set name="title" value="%{'Edit'}"/>
</s:else>

<br/>
<table>
    <tr>
        <td>
            <img src="<s:url value="/img/icons/component.png"/>"> 
        </td>
        <td>
            <span class="title">
                <s:property value="#title"/> Module
            </span>
        </td>
    </tr>
</table>
<br/><br/>

<s:form namespace="/module" action="update_%{module.moduleCode}">
    <s:actionerror/>
    <table>
        <tr>
            <td valign="top">Module Code:</td>
            <td><s:textfield name="module.moduleCode" size="20" readonly="%{isUpdate}"/> 
                <s:fielderror><s:param>module.moduleCode</s:param></s:fielderror></td>
        </tr> 
        <tr>
            <td>Title:</td>
            <td><s:textfield name="module.title" size="20" /> 
                <s:fielderror><s:param>module.title</s:param></s:fielderror></td>
        </tr> 
        <tr>
            <td>Description:</td>
            <td><s:textarea name="module.description" rows="5" cols="40"/> </td>
        </tr> 
        <tr>
            <td>Type:</td>
            <td><s:select name="module.type" list="{'Core','Elective'}"/></td>
        </tr>
        <tr>
            <td>Maximum Mark:</td>
            <td><s:textfield name="module.maximumMarks" size="20" />
                <s:fielderror><s:param>module.maximumMarks</s:param></s:fielderror></td>
        </tr>
        <tr>
            <td>Weight:</td>
            <td><s:textfield name="module.weight" size="20" />
                <s:fielderror><s:param>module.weight</s:param></s:fielderror></td>
        </tr>
        <tr>
            <td>Range:</td>
            <td>From&nbsp;<s:select name="module.fromRange" list="{'0','1','2','3','4','5','6','7','8','9','10'}"/>&nbsp;&nbsp;
                To&nbsp;<s:select name="module.toRange" list="{'0','1','2','3','4','5','6','7','8','9','10'}"/></td>
        </tr>
        <tr>
            <td>Owner:</td>
            <td><s:select name="module.owner" list="lecturerNames"  /></td>
        </tr>
        <tr>
            <td>Lecturers:</td>
            <td><s:select name="lecturers" list="lecturerNames" multiple="true"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <s:hidden name="update"/>
                <br/>
                <button id="addButton">&nbsp;&nbsp;Add module</button>
            </td>
        </tr>
    </table>
</s:form>

<script type="text/javascript">
    
    $(function(){
        $( "#addButton").button({icons: {primary:'ui-icon-circle-plus'}});
    });
    
</script>